package main

import "fmt"

func printMap(cityMap map[string]string) {
	// cityMap 是一个引用传递
	for key, value := range cityMap {
		fmt.Println("key =", key, " value = ", value)
	}

}

func ChangeValue(cityMap map[string]string) {
	cityMap["England"] = "London"
}

func main() {

	cityMap := make(map[string]string)

	// add
	cityMap["China"] = "Beijing"
	cityMap["Japan"] = "Tokyo"
	cityMap["USA"] = "Washington"

	// for loop
	printMap(cityMap)

	// delete
	delete(cityMap, "USA")

	// modify
	cityMap["China"] = "DC"
	ChangeValue(cityMap)

	fmt.Println("========")

	// for loop
	printMap(cityMap)

}
